import React from 'react';
// import PropTypes from 'prop-types';
import styles from './Avatar.css';
import constans from '../constan';

const Avatar = ({ user }) => {
    const { login_state, phone, account, photo, nickname } = user;
    return (
        <div className={styles.avatarwrap}>
            <div className={styles.avatarhead}>
                <div className={styles.imgwrap}>
                    <img alt="头像" src={login_state !== constans.SuccessLogin ? 'https://image.flaticon.com/icons/svg/145/145867.svg' : photo}></img>
                </div>
            </div>
            <div className={styles.avatarcontent}>
                <div className={styles.contenttitle}>
                    {login_state !== constans.SuccessLogin ? '尚未登陆' : nickname}
                </div>
                <div className={styles.contentde}>
                    {login_state !== constans.SuccessLogin ? '' : (_ => {
                        return (<div>帐号：{account} / {phone}</div>)
                        })()
                    }
                </div>
            </div>
        </div>
    );
};

Avatar.propTypes = {
};

export default Avatar;
